<!DOCTYPE html>
    <head>
        <title>Microsoft Widget API Sample</title>
        <meta charset="UTF-8"/>3
        <script type="text/javascript" src="js/jquery.min.js"></script>
    </head>
    <body>
        <button id="change">中英文切换</button
        </br></br></br></br></br></br></br></br></br></br></br></br></br></br></br>
        <div style="text-align: center" >
            你在干什么？你好，啊啊，你是谁，测试测试，看看怎样？
        </div>
    </body>
    <script type="text/javascript">
        $("#change").click(function(){
            translate();
        })
    </script>
    </html>
    <script type="text/javascript"></script>
<script type="text/javascript">
$(function(){ 
      // do something 
    var script=document.createElement("script");  
    script.type="text/javascript";  
    script.src="http://www.microsoftTranslator.com/ajax/v3/WidgetV3.ashx?siteData=ueOIGRSKkd965FeEGM5JtQ**";  
    document.getElementsByTagName('head')[0].appendChild(script);  
    var value = sessionStorage.getItem("language");
    //document.onreadystatechange = function () {
        if (document.readyState == 'complete') {
            if(value==="1"){
                Microsoft.Translator.Widget.Translate('zh-CHS', 'en', onProgress, onError, onComplete, onRestoreOriginal, 2000);
            }
        }
   // }
    function onProgress(value) {
    }
    function onError(error) {
    }
    function onComplete() {
        $("#WidgetFloaterPanels").hide();
    }
    function onRestoreOriginal() { 
    }
});

function translate(){
    var value = sessionStorage.getItem("language");
    if(value==="1"){
        sessionStorage.setItem("language", "0"); 
    }else{
        sessionStorage.setItem("language", "1");
    }
    window.location.reload();//刷新当前页面.
}
</script>

